<?php
/**
* @author moufer<moufer@163.com>
* @copyright www.modoer.com
*/
!defined('IN_MUDDER') && exit('Access Denied');
class SpaceModel {
    var $db = null;
    var $tablename = 'spaces';
    var $uid = 0;

    function SpaceModel() {
        global $db,$dbpre;

        $this->db = &$db;
        $this->tablename = $dbpre.$this->tablename;
    }

    function setUid($uid) {
        $this->uid = $uid;
    }

    function & readInfo() {
        global $dbpre;
        $result = $this->db->get_one("SELECT m.*,s.* FROM {$dbpre}members m LEFT JOIN {$this->tablename} s ON(m.uid=s.uid) WHERE m.uid='{$this->uid}'");
        if(empty($result)) {
            $result = false;
        } else {
            if(!function_exists('memberToArray')) {
                require_once(MUDDER_ROOT.'./member/include/fun_member.php');
            }
            $result = memberToArray($result);
        }
        return $result;
    }

    function updatePageview() {
        $this->db->update("UPDATE {$this->tablename} SET pageview=pageview+1 WHERE uid='{$this->uid}'");
    }

}
?>